// 版权归 瞄你个汪 所有。使用本代码应遵守相关法律法规和Apache 2.0开源许可要求。
package top.geeke.entity.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import top.geeke.toolkit.supertable.annotation.SuperColumn;

import java.time.LocalDateTime;

/**
 * <p>
 * 基类
 * </p>
 * @author 瞄你个汪
 * @since 2024-05-01 12:00:00
 */
@Setter
@Getter
public class EntityBase extends EntityBaseId {

    @SuperColumn(value = "创建时间", defaultValue = "CURRENT_TIMESTAMP", nullable = true)
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @SuperColumn(value = "创建用户ID", nullable = true)
    @TableField(fill = FieldFill.INSERT)
    private Long createById;

    @SuperColumn(value = "创建用户姓名", nullable = true)
    @TableField(fill = FieldFill.INSERT)
    private String createByName;

    @SuperColumn(value = "修改时间", nullable = true, extra = "ON UPDATE CURRENT_TIMESTAMP")
    @TableField(fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;

    @SuperColumn(value = "修改用户ID", nullable = true)
    @TableField(fill = FieldFill.UPDATE)
    private Long updateById;

    @SuperColumn(value = "修改用户姓名", nullable = true)
    @TableField(fill = FieldFill.UPDATE)
    private String updateByName;

    @SuperColumn(value = "删除时间", nullable = true)
    private LocalDateTime deleteTime;

    @SuperColumn(value = "删除用户ID", nullable = true)
    private Long deleteById;

    @SuperColumn(value = "删除用户姓名", nullable = true)
    private String deleteByName;

    @TableLogic
    @JsonIgnore
    @JsonIgnoreProperties
    @SuperColumn(value = "软删除")
    private boolean isDelete;

    @JsonIgnore
    @JsonIgnoreProperties
    @SuperColumn(value = "租户ID")
    @TableField(fill = FieldFill.INSERT)
    private Long tenantId;
}
